#include "./Update.h"

using namespace Commands;

Update::Update(
		GameLogic::Objects::GameObject::IdType object_id,
		Data* data
) :
	object_id_( object_id )
,	data_( data )
{}

void Update::execute( GameLogic::Simulation* s ) {
	s->updateObject( object_id_, data_ );
}

void Update::serialize( std::ostringstream& s ) {
	s << Network::UDPIO::OBJECT_UPDATE << SEPARATOR;
	s << object_id_.toNumeric() << SEPARATOR;
	s << data_->behaviour_flags << SEPARATOR;
	s << data_->facing.x << SEPARATOR;
	s << data_->facing.y << SEPARATOR;
	s << data_->position.x << SEPARATOR;
	s << data_->position.y << SEPARATOR;
	s << data_->time;
}
